package com.lk.springboot.dao;

import com.lk.springboot.bean.Press;
import com.lk.springboot.bean.Users;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UsersMapper {
    @Select("select * from users ")
    List<Users> findAll();

    @Select("select * from  users where u_name like concat('%',#{u_name},'%')")
    List<Users> findByName(String u_name);

    @Select("select * from  users where sex like concat('%',#{sex},'%')")
    List<Users> findBySex(String sex);

    @Insert(" insert into users (u_name,sex,age,phone) values(#{u_name},#{sex},#{age},#{phone}) ")
    public int save(Users users);

    @Update("update users set u_name=#{u_name},sex=#{sex},age=#{age},phone=#{phone} where u_id=#{u_id} ")
    public int update(Users users);

    @Delete(" delete from users where u_id= #{u_id} ")
    public void delete(int u_id);
}
